package schoolWork.work05.test2;

import javax.swing.*;
import java.awt.*;

public class MyJFrame extends JFrame {
    JLabel jLabel1 = new JLabel("姓名:");
    JLabel jLabel2 = new JLabel("性别:");
    JLabel jLabel3 = new JLabel("身份:");
    JLabel jLabel4 = new JLabel("单位:");
    JLabel jLabel5 = new JLabel("证件号码:");
    JLabel jLabel6 = new JLabel("注册日期:");
    JLabel jLabel7 = new JLabel("有效日期:");

    JTextField nameTxt = new JTextField();
    JComboBox  genderCb = new JComboBox();
    JComboBox  identityCb = new JComboBox();
    JComboBox    unitCb = new JComboBox();
    JTextField IDTxt = new JTextField();
    JTextField RegisterDateTxt = new JTextField();
    JTextField ValidDateTxt = new JTextField();


    public MyJFrame(){
        JPanel jPanel1 = new JPanel();
        jPanel1.setLayout(new GridLayout(7,2));

        JPanel jPanel2 = new JPanel();
        jPanel2.setLayout(new GridLayout(1,4));

       JButton btn1 = new JButton("添加");
       JButton btn2 = new JButton("删除");
       JButton btn3 = new JButton("撤销");
       JButton btn4 = new JButton("退出");

        genderCb.addItem("男");
        genderCb.addItem("女");
        genderCb.setSelectedIndex(0);
        genderCb.setEditable(true);

        identityCb.addItem("学生");
        identityCb.addItem("教师");
        identityCb.addItem("其他");
        identityCb.setSelectedIndex(0);
        identityCb.setEditable(true);

        unitCb.addItem("计算机系");
        unitCb.addItem("自动化系");
        unitCb.addItem("数学系");
        unitCb.setSelectedIndex(0);
        unitCb.setEditable(true);

        jPanel1.add(jLabel1);
        jPanel1.add(nameTxt);
        jPanel1.add(jLabel2);
        jPanel1.add(genderCb);
        jPanel1.add(jLabel3);
        jPanel1.add(identityCb);
        jPanel1.add(jLabel4);
        jPanel1.add(unitCb);
        jPanel1.add(jLabel5);
        jPanel1.add(IDTxt);
        jPanel1.add(jLabel6);
        jPanel1.add(RegisterDateTxt);
        jPanel1.add(jLabel7);
        jPanel1.add(ValidDateTxt);

        jPanel2.add(btn1);
        jPanel2.add(btn2);
        jPanel2.add(btn3);
        jPanel2.add(btn4);

        this.add(jPanel1,BorderLayout.CENTER);
        this.add(jPanel2,BorderLayout.SOUTH);
        this.setTitle("图书证办理");
        this.setBounds(500,300,500,400);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
    }

}
